load("//bazel:mongo_src_rules.bzl", "mongo_cc_library")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "batch_write_types",
    srcs = [
        "batched_command_request.cpp",
        "batched_command_response.cpp",
        "batched_upsert_detail.cpp",
        "bulk_write_command_modifier.cpp",
        "write_command_ref.cpp",
        "write_op_helper.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:commands",
        "//src/mongo/db:common",
        "//src/mongo/db:error_labels",
        "//src/mongo/db:expression_context_builder",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:vector_clock",
        "//src/mongo/db/commands/query_cmd:bulk_write_parser",
        "//src/mongo/db/query/write_ops:write_ops_parsers",
        "//src/mongo/db/repl:optime",
        "//src/mongo/rpc:command_status",
        "//src/mongo/s:common_s",
    ],
)

mongo_cc_library(
    name = "wc_error",
    srcs = [
        "wc_error.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/rpc:command_status",
        "//src/mongo/s:sharding_router_api",
    ],
)

mongo_cc_library(
    name = "fle",
    srcs = [
        "fle.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:fle_crud",
        "//src/mongo/db/commands/query_cmd:bulk_write_common",
        "//src/mongo/s:sharding_router_api",
    ],
)

mongo_cc_library(
    name = "pause_migrations_during_multi_updates_enablement",
    srcs = [
        "pause_migrations_during_multi_updates_enablement.cpp",
        "//src/mongo/db/topology/cluster_parameters:migration_blocking_operation_cluster_parameters_gen",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/s:sharding_router_api",
    ],
)

mongo_cc_library(
    name = "sharded_write_ops",
    srcs = [
        "batch_write_exec.cpp",
        "batch_write_op.cpp",
        "bulk_write_exec.cpp",
        "coordinate_multi_update_util.cpp",
        "write_op.cpp",
    ],
    deps = [
        "batch_write_types",
        "fle",
        "pause_migrations_during_multi_updates_enablement",
        "wc_error",
        "//src/mongo:base",
        "//src/mongo/db/timeseries/write_ops:timeseries_write_ops_utils",
        "//src/mongo/s:sharding_write_without_shard_key_api",
        "//src/mongo/s/commands/query_cmd:populate_cursor",
    ],
)
